package com.sup.generator.http;

import com.sup.generator.fixedvalue.GrMessage;
import lombok.Data;

/**
 * @author Zh
 * @version v1.0
 * @description:
 * @date 2020/11/13 13:57
 */
@Data
public class GrResponseData {

    private Integer code;
    private String msg;
    private Object data;
    private String token;

    public GrResponseData(Integer code, Object data, String msg,String token){
        this.code = code;
        this.data = data;
        this.msg = msg;
        this.token = token;
    }

    public static GrResponseData success(Object data, GrMessage msg){
        return new GrResponseData(200,data, msg.getMessage(),null);

    }

    public static GrResponseData success( GrMessage msg){
        return new GrResponseData(200,null, msg.getMessage(),null);

    }

    public static GrResponseData success( Object data, GrMessage msg,String token){
        return new GrResponseData(200,data, msg.getMessage(),token);

    }

}
